home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / lispref.info-10 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  46.8 KB  |  1,130 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo-1.63
  2. from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995
  12.  
  13.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  14. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  15. Copyright (C) 1995 Amdahl Corporation.  Copyright (C) 1995 Ben Wing.
  16.  
  17.    Permission is granted to make and distribute verbatim copies of this
  18. manual provided the copyright notice and this permission notice are
  19. preserved on all copies.
  20.  
  21.    Permission is granted to copy and distribute modified versions of
  22. this manual under the conditions for verbatim copying, provided that the
  23. entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that this permission notice may be stated in a
  29. translation approved by the Foundation.
  30.  
  31.    Permission is granted to copy and distribute modified versions of
  32. this manual under the conditions for verbatim copying, provided also
  33. that the section entitled "GNU General Public License" is included
  34. exactly as in the original, and provided that the entire resulting
  35. derived work is distributed under the terms of a permission notice
  36. identical to this one.
  37.  
  38.    Permission is granted to copy and distribute translations of this
  39. manual into another language, under the above conditions for modified
  40. versions, except that the section entitled "GNU General Public License"
  41. may be included in a translation approved by the Free Software
  42. Foundation instead of in the original English.
  43.  
  44. 
  45. File: lispref.info,  Node: Simple Macro,  Next: Expansion,  Up: Macros
  46.  
  47. A Simple Example of a Macro
  48. ===========================
  49.  
  50.    Suppose we would like to define a Lisp construct to increment a
  51. variable value, much like the `++' operator in C.  We would like to
  52. write `(inc x)' and have the effect of `(setq x (1+ x))'.  Here's a
  53. macro definition that does the job:
  54.  
  55.      (defmacro inc (var)
  56.         (list 'setq var (list '1+ var)))
  57.  
  58.    When this is called with `(inc x)', the argument `var' has the value
  59. `x'--*not* the *value* of `x'.  The body of the macro uses this to
  60. construct the expansion, which is `(setq x (1+ x))'.  Once the macro
  61. definition returns this expansion, Lisp proceeds to evaluate it, thus
  62. incrementing `x'.
  63.  
  64. 
  65. File: lispref.info,  Node: Expansion,  Next: Compiling Macros,  Prev: Simple Macro,  Up: Macros
  66.  
  67. Expansion of a Macro Call
  68. =========================
  69.  
  70.    A macro call looks just like a function call in that it is a list
  71. which starts with the name of the macro.  The rest of the elements of
  72. the list are the arguments of the macro.
  73.  
  74.    Evaluation of the macro call begins like evaluation of a function
  75. call except for one crucial difference: the macro arguments are the
  76. actual expressions appearing in the macro call.  They are not evaluated
  77. before they are given to the macro definition.  By contrast, the
  78. arguments of a function are results of evaluating the elements of the
  79. function call list.
  80.  
  81.    Having obtained the arguments, Lisp invokes the macro definition just
  82. as a function is invoked.  The argument variables of the macro are bound
  83. to the argument values from the macro call, or to a list of them in the
  84. case of a `&rest' argument.  And the macro body executes and returns
  85. its value just as a function body does.
  86.  
  87.    The second crucial difference between macros and functions is that
  88. the value returned by the macro body is not the value of the macro call.
  89. Instead, it is an alternate expression for computing that value, also
  90. known as the "expansion" of the macro.  The Lisp interpreter proceeds
  91. to evaluate the expansion as soon as it comes back from the macro.
  92.  
  93.    Since the expansion is evaluated in the normal manner, it may contain
  94. calls to other macros.  It may even be a call to the same macro, though
  95. this is unusual.
  96.  
  97.    You can see the expansion of a given macro call by calling
  98. `macroexpand'.
  99.  
  100.  - Function: macroexpand FORM &optional ENVIRONMENT
  101.      This function expands FORM, if it is a macro call.  If the result
  102.      is another macro call, it is expanded in turn, until something
  103.      which is not a macro call results.  That is the value returned by
  104.      `macroexpand'.  If FORM is not a macro call to begin with, it is
  105.      returned as given.
  106.  
  107.      Note that `macroexpand' does not look at the subexpressions of
  108.      FORM (although some macro definitions may do so).  Even if they
  109.      are macro calls themselves, `macroexpand' does not expand them.
  110.  
  111.      The function `macroexpand' does not expand calls to inline
  112.      functions.  Normally there is no need for that, since a call to an
  113.      inline function is no harder to understand than a call to an
  114.      ordinary function.
  115.  
  116.      If ENVIRONMENT is provided, it specifies an alist of macro
  117.      definitions that shadow the currently defined macros.  Byte
  118.      compilation uses this feature.
  119.  
  120.           (defmacro inc (var)
  121.               (list 'setq var (list '1+ var)))
  122.                => inc
  123.  
  124.           (macroexpand '(inc r))
  125.                => (setq r (1+ r))
  126.  
  127.           (defmacro inc2 (var1 var2)
  128.               (list 'progn (list 'inc var1) (list 'inc var2)))
  129.                => inc2
  130.  
  131.           (macroexpand '(inc2 r s))
  132.                => (progn (inc r) (inc s))  ; `inc' not expanded here.
  133.  
  134. 
  135. File: lispref.info,  Node: Compiling Macros,  Next: Defining Macros,  Prev: Expansion,  Up: Macros
  136.  
  137. Macros and Byte Compilation
  138. ===========================
  139.  
  140.    You might ask why we take the trouble to compute an expansion for a
  141. macro and then evaluate the expansion.  Why not have the macro body
  142. produce the desired results directly?  The reason has to do with
  143. compilation.
  144.  
  145.    When a macro call appears in a Lisp program being compiled, the Lisp
  146. compiler calls the macro definition just as the interpreter would, and
  147. receives an expansion.  But instead of evaluating this expansion, it
  148. compiles the expansion as if it had appeared directly in the program.
  149. As a result, the compiled code produces the value and side effects
  150. intended for the macro, but executes at full compiled speed.  This would
  151. not work if the macro body computed the value and side effects
  152. itself--they would be computed at compile time, which is not useful.
  153.  
  154.    In order for compilation of macro calls to work, the macros must be
  155. defined in Lisp when the calls to them are compiled.  The compiler has a
  156. special feature to help you do this: if a file being compiled contains a
  157. `defmacro' form, the macro is defined temporarily for the rest of the
  158. compilation of that file.  To use this feature, you must define the
  159. macro in the same file where it is used and before its first use.
  160.  
  161.    Byte-compiling a file executes any `require' calls at top-level in
  162. the file.  This is in case the file needs the required packages for
  163. proper compilation.  One way to ensure that necessary macro definitions
  164. are available during compilation is to require the files that define
  165. them (*note Named Features::.).  To avoid loading the macro definition
  166. files when someone *runs* the compiled program, write
  167. `eval-when-compile' around the `require' calls (*note Eval During
  168. Compile::.).
  169.  
  170. 
  171. File: lispref.info,  Node: Defining Macros,  Next: Backquote,  Prev: Compiling Macros,  Up: Macros
  172.  
  173. Defining Macros
  174. ===============
  175.  
  176.    A Lisp macro is a list whose CAR is `macro'.  Its CDR should be a
  177. function; expansion of the macro works by applying the function (with
  178. `apply') to the list of unevaluated argument-expressions from the macro
  179. call.
  180.  
  181.    It is possible to use an anonymous Lisp macro just like an anonymous
  182. function, but this is never done, because it does not make sense to pass
  183. an anonymous macro to functionals such as `mapcar'.  In practice, all
  184. Lisp macros have names, and they are usually defined with the special
  185. form `defmacro'.
  186.  
  187.  - Special Form: defmacro NAME ARGUMENT-LIST BODY-FORMS...
  188.      `defmacro' defines the symbol NAME as a macro that looks like this:
  189.  
  190.           (macro lambda ARGUMENT-LIST . BODY-FORMS)
  191.  
  192.      This macro object is stored in the function cell of NAME.  The
  193.      value returned by evaluating the `defmacro' form is NAME, but
  194.      usually we ignore this value.
  195.  
  196.      The shape and meaning of ARGUMENT-LIST is the same as in a
  197.      function, and the keywords `&rest' and `&optional' may be used
  198.      (*note Argument List::.).  Macros may have a documentation string,
  199.      but any `interactive' declaration is ignored since macros cannot be
  200.      called interactively.
  201.  
  202. 
  203. File: lispref.info,  Node: Backquote,  Next: Problems with Macros,  Prev: Defining Macros,  Up: Macros
  204.  
  205. Backquote
  206. =========
  207.  
  208.    Macros often need to construct large list structures from a mixture
  209. of constants and nonconstant parts.  To make this easier, use the macro
  210. ``' (often called "backquote").
  211.  
  212.    Backquote allows you to quote a list, but selectively evaluate
  213. elements of that list.  In the simplest case, it is identical to the
  214. special form `quote' (*note Quoting::.).  For example, these two forms
  215. yield identical results:
  216.  
  217.      `(a list of (+ 2 3) elements)
  218.           => (a list of (+ 2 3) elements)
  219.      '(a list of (+ 2 3) elements)
  220.           => (a list of (+ 2 3) elements)
  221.  
  222.    The special marker `,' inside of the argument to backquote indicates
  223. a value that isn't constant.  Backquote evaluates the argument of `,'
  224. and puts the value in the list structure:
  225.  
  226.      (list 'a 'list 'of (+ 2 3) 'elements)
  227.           => (a list of 5 elements)
  228.      `(a list of ,(+ 2 3) elements)
  229.           => (a list of 5 elements)
  230.  
  231.    You can also "splice" an evaluated value into the resulting list,
  232. using the special marker `,@'.  The elements of the spliced list become
  233. elements at the same level as the other elements of the resulting list.
  234. The equivalent code without using ``' is often unreadable.  Here are
  235. some examples:
  236.  
  237.      (setq some-list '(2 3))
  238.           => (2 3)
  239.      (cons 1 (append some-list '(4) some-list))
  240.           => (1 2 3 4 2 3)
  241.      `(1 ,@some-list 4 ,@some-list)
  242.           => (1 2 3 4 2 3)
  243.      
  244.      (setq list '(hack foo bar))
  245.           => (hack foo bar)
  246.      (cons 'use
  247.        (cons 'the
  248.          (cons 'words (append (cdr list) '(as elements)))))
  249.           => (use the words foo bar as elements)
  250.      `(use the words ,@(cdr list) as elements)
  251.           => (use the words foo bar as elements)
  252.  
  253.      Before Emacs version 19.29, ``' used a different syntax which
  254.      required an extra level of parentheses around the entire backquote
  255.      construct.  Likewise, each `,' or `,@' substition required an
  256.      extra level of parentheses surrounding both the `,' or `,@' and
  257.      the following expression.  The old syntax required whitespace
  258.      between the ``', `,' or `,@' and the following expression.
  259.  
  260.      This syntax is still accepted, but no longer recommended except for
  261.      compatibility with old Emacs versions.
  262.  
  263. 
  264. File: lispref.info,  Node: Problems with Macros,  Prev: Backquote,  Up: Macros
  265.  
  266. Common Problems Using Macros
  267. ============================
  268.  
  269.    The basic facts of macro expansion have counterintuitive
  270. consequences.  This section describes some important consequences that
  271. can lead to trouble, and rules to follow to avoid trouble.
  272.  
  273. * Menu:
  274.  
  275. * Argument Evaluation::    The expansion should evaluate each macro arg once.
  276. * Surprising Local Vars::  Local variable bindings in the expansion
  277.                               require special care.
  278. * Eval During Expansion::  Don't evaluate them; put them in the expansion.
  279. * Repeated Expansion::     Avoid depending on how many times expansion is done.
  280.  
  281. 
  282. File: lispref.info,  Node: Argument Evaluation,  Next: Surprising Local Vars,  Up: Problems with Macros
  283.  
  284. Evaluating Macro Arguments Repeatedly
  285. -------------------------------------
  286.  
  287.    When defining a macro you must pay attention to the number of times
  288. the arguments will be evaluated when the expansion is executed.  The
  289. following macro (used to facilitate iteration) illustrates the problem.
  290. This macro allows us to write a simple "for" loop such as one might
  291. find in Pascal.
  292.  
  293.      (defmacro for (var from init to final do &rest body)
  294.        "Execute a simple \"for\" loop.
  295.      For example, (for i from 1 to 10 do (print i))."
  296.        (list 'let (list (list var init))
  297.              (cons 'while (cons (list '<= var final)
  298.                                 (append body (list (list 'inc var)))))))
  299.      => for
  300.      (for i from 1 to 3 do
  301.         (setq square (* i i))
  302.         (princ (format "\n%d %d" i square)))
  303.      ==>
  304.  
  305.      (let ((i 1))
  306.        (while (<= i 3)
  307.          (setq square (* i i))
  308.          (princ (format "%d      %d" i square))
  309.          (inc i)))
  310.  
  311.  
  312.      -|1       1
  313.           -|2       4
  314.           -|3       9
  315.      => nil
  316.  
  317. (The arguments `from', `to', and `do' in this macro are "syntactic
  318. sugar"; they are entirely ignored.  The idea is that you will write
  319. noise words (such as `from', `to', and `do') in those positions in the
  320. macro call.)
  321.  
  322.    Here's an equivalent definition simplified through use of backquote:
  323.  
  324.      (defmacro for (var from init to final do &rest body)
  325.        "Execute a simple \"for\" loop.
  326.      For example, (for i from 1 to 10 do (print i))."
  327.        `(let ((,var ,init))
  328.           (while (<= ,var ,final)
  329.             ,@body
  330.             (inc ,var))))
  331.  
  332.    Both forms of this definition (with backquote and without) suffer
  333. from the defect that FINAL is evaluated on every iteration.  If FINAL
  334. is a constant, this is not a problem.  If it is a more complex form,
  335. say `(long-complex-calculation x)', this can slow down the execution
  336. significantly.  If FINAL has side effects, executing it more than once
  337. is probably incorrect.
  338.  
  339.    A well-designed macro definition takes steps to avoid this problem by
  340. producing an expansion that evaluates the argument expressions exactly
  341. once unless repeated evaluation is part of the intended purpose of the
  342. macro.  Here is a correct expansion for the `for' macro:
  343.  
  344.      (let ((i 1)
  345.            (max 3))
  346.        (while (<= i max)
  347.          (setq square (* i i))
  348.          (princ (format "%d      %d" i square))
  349.          (inc i)))
  350.  
  351.    Here is a macro definition that creates this expansion:
  352.  
  353.      (defmacro for (var from init to final do &rest body)
  354.        "Execute a simple for loop: (for i from 1 to 10 do (print i))."
  355.        `(let ((,var ,init)
  356.               (max ,final))
  357.           (while (<= ,var max)
  358.             ,@body
  359.             (inc ,var))))
  360.  
  361.    Unfortunately, this introduces another problem.
  362.  
  363.    Proceed to the following node.
  364.  
  365. 
  366. File: lispref.info,  Node: Surprising Local Vars,  Next: Eval During Expansion,  Prev: Argument Evaluation,  Up: Problems with Macros
  367.  
  368. Local Variables in Macro Expansions
  369. -----------------------------------
  370.  
  371.    In the previous section, the definition of `for' was fixed as
  372. follows to make the expansion evaluate the macro arguments the proper
  373. number of times:
  374.  
  375.      (defmacro for (var from init to final do &rest body)
  376.        "Execute a simple for loop: (for i from 1 to 10 do (print i))."
  377.  
  378.      `(let ((,var ,init)
  379.               (max ,final))
  380.           (while (<= ,var max)
  381.             ,@body
  382.             (inc ,var))))
  383.  
  384.    The new definition of `for' has a new problem: it introduces a local
  385. variable named `max' which the user does not expect.  This causes
  386. trouble in examples such as the following:
  387.  
  388.      (let ((max 0))
  389.        (for x from 0 to 10 do
  390.          (let ((this (frob x)))
  391.            (if (< max this)
  392.                (setq max this)))))
  393.  
  394. The references to `max' inside the body of the `for', which are
  395. supposed to refer to the user's binding of `max', really access the
  396. binding made by `for'.
  397.  
  398.    The way to correct this is to use an uninterned symbol instead of
  399. `max' (*note Creating Symbols::.).  The uninterned symbol can be bound
  400. and referred to just like any other symbol, but since it is created by
  401. `for', we know that it cannot already appear in the user's program.
  402. Since it is not interned, there is no way the user can put it into the
  403. program later.  It will never appear anywhere except where put by
  404. `for'.  Here is a definition of `for' that works this way:
  405.  
  406.      (defmacro for (var from init to final do &rest body)
  407.        "Execute a simple for loop: (for i from 1 to 10 do (print i))."
  408.        (let ((tempvar (make-symbol "max")))
  409.          `(let ((,var ,init)
  410.                 (,tempvar ,final))
  411.             (while (<= ,var ,tempvar)
  412.               ,@body
  413.               (inc ,var)))))
  414.  
  415. This creates an uninterned symbol named `max' and puts it in the
  416. expansion instead of the usual interned symbol `max' that appears in
  417. expressions ordinarily.
  418.  
  419. 
  420. File: lispref.info,  Node: Eval During Expansion,  Next: Repeated Expansion,  Prev: Surprising Local Vars,  Up: Problems with Macros
  421.  
  422. Evaluating Macro Arguments in Expansion
  423. ---------------------------------------
  424.  
  425.    Another problem can happen if you evaluate any of the macro argument
  426. expressions during the computation of the expansion, such as by calling
  427. `eval' (*note Eval::.).  If the argument is supposed to refer to the
  428. user's variables, you may have trouble if the user happens to use a
  429. variable with the same name as one of the macro arguments.  Inside the
  430. macro body, the macro argument binding is the most local binding of this
  431. variable, so any references inside the form being evaluated do refer to
  432. it.  Here is an example:
  433.  
  434.      (defmacro foo (a)
  435.        (list 'setq (eval a) t))
  436.           => foo
  437.      (setq x 'b)
  438.      (foo x) ==> (setq b t)
  439.           => t                  ; and `b' has been set.
  440.      ;; but
  441.      (setq a 'c)
  442.      (foo a) ==> (setq a t)
  443.           => t                  ; but this set `a', not `c'.
  444.  
  445.    It makes a difference whether the user's variable is named `a' or
  446. `x', because `a' conflicts with the macro argument variable `a'.
  447.  
  448.    Another reason not to call `eval' in a macro definition is that it
  449. probably won't do what you intend in a compiled program.  The
  450. byte-compiler runs macro definitions while compiling the program, when
  451. the program's own computations (which you might have wished to access
  452. with `eval') don't occur and its local variable bindings don't exist.
  453.  
  454.    The safe way to work with the run-time value of an expression is to
  455. put the expression into the macro expansion, so that its value is
  456. computed as part of executing the expansion.
  457.  
  458. 
  459. File: lispref.info,  Node: Repeated Expansion,  Prev: Eval During Expansion,  Up: Problems with Macros
  460.  
  461. How Many Times is the Macro Expanded?
  462. -------------------------------------
  463.  
  464.    Occasionally problems result from the fact that a macro call is
  465. expanded each time it is evaluated in an interpreted function, but is
  466. expanded only once (during compilation) for a compiled function.  If the
  467. macro definition has side effects, they will work differently depending
  468. on how many times the macro is expanded.
  469.  
  470.    In particular, constructing objects is a kind of side effect.  If the
  471. macro is called once, then the objects are constructed only once.  In
  472. other words, the same structure of objects is used each time the macro
  473. call is executed.  In interpreted operation, the macro is reexpanded
  474. each time, producing a fresh collection of objects each time.  Usually
  475. this does not matter--the objects have the same contents whether they
  476. are shared or not.  But if the surrounding program does side effects on
  477. the objects, it makes a difference whether they are shared.  Here is an
  478. example:
  479.  
  480.      (defmacro empty-object ()
  481.        (list 'quote (cons nil nil)))
  482.  
  483.      (defun initialize (condition)
  484.        (let ((object (empty-object)))
  485.          (if condition
  486.              (setcar object condition))
  487.          object))
  488.  
  489. If `initialize' is interpreted, a new list `(nil)' is constructed each
  490. time `initialize' is called.  Thus, no side effect survives between
  491. calls.  If `initialize' is compiled, then the macro `empty-object' is
  492. expanded during compilation, producing a single "constant" `(nil)' that
  493. is reused and altered each time `initialize' is called.
  494.  
  495.    One way to avoid pathological cases like this is to think of
  496. `empty-object' as a funny kind of constant, not as a memory allocation
  497. construct.  You wouldn't use `setcar' on a constant such as `'(nil)',
  498. so naturally you won't use it on `(empty-object)' either.
  499.  
  500. 
  501. File: lispref.info,  Node: Loading,  Next: Byte Compilation,  Prev: Macros,  Up: Top
  502.  
  503. Loading
  504. *******
  505.  
  506.    Loading a file of Lisp code means bringing its contents into the Lisp
  507. environment in the form of Lisp objects.  XEmacs finds and opens the
  508. file, reads the text, evaluates each form, and then closes the file.
  509.  
  510.    The load functions evaluate all the expressions in a file just as
  511. the `eval-current-buffer' function evaluates all the expressions in a
  512. buffer.  The difference is that the load functions read and evaluate
  513. the text in the file as found on disk, not the text in an Emacs buffer.
  514.  
  515.    The loaded file must contain Lisp expressions, either as source code
  516. or as byte-compiled code.  Each form in the file is called a "top-level
  517. form".  There is no special format for the forms in a loadable file;
  518. any form in a file may equally well be typed directly into a buffer and
  519. evaluated there.  (Indeed, most code is tested this way.)  Most often,
  520. the forms are function definitions and variable definitions.
  521.  
  522.    A file containing Lisp code is often called a "library".  Thus, the
  523. "Rmail library" is a file containing code for Rmail mode.  Similarly, a
  524. "Lisp library directory" is a directory of files containing Lisp code.
  525.  
  526. * Menu:
  527.  
  528. * How Programs Do Loading::     The `load' function and others.
  529. * Autoload::                    Setting up a function to autoload.
  530. * Repeated Loading::            Precautions about loading a file twice.
  531. * Named Features::              Loading a library if it isn't already loaded.
  532. * Unloading::            How to "unload" a library that was loaded.
  533. * Hooks for Loading::        Providing code to be run when
  534.                   particular libraries are loaded.
  535.  
  536. 
  537. File: lispref.info,  Node: How Programs Do Loading,  Next: Autoload,  Up: Loading
  538.  
  539. How Programs Do Loading
  540. =======================
  541.  
  542.    Emacs Lisp has several interfaces for loading.  For example,
  543. `autoload' creates a placeholder object for a function in a file;
  544. trying to call the autoloading function loads the file to get the
  545. function's real definition (*note Autoload::.).  `require' loads a file
  546. if it isn't already loaded (*note Named Features::.).  Ultimately, all
  547. these facilities call the `load' function to do the work.
  548.  
  549.  - Function: load FILENAME &optional MISSING-OK NOMESSAGE NOSUFFIX
  550.      This function finds and opens a file of Lisp code, evaluates all
  551.      the forms in it, and closes the file.
  552.  
  553.      To find the file, `load' first looks for a file named
  554.      `FILENAME.elc', that is, for a file whose name is FILENAME with
  555.      `.elc' appended.  If such a file exists, it is loaded.  If there
  556.      is no file by that name, then `load' looks for a file named
  557.      `FILENAME.el'.  If that file exists, it is loaded.  Finally, if
  558.      neither of those names is found, `load' looks for a file named
  559.      FILENAME with nothing appended, and loads it if it exists.  (The
  560.      `load' function is not clever about looking at FILENAME.  In the
  561.      perverse case of a file named `foo.el.el', evaluation of `(load
  562.      "foo.el")' will indeed find it.)
  563.  
  564.      If the optional argument NOSUFFIX is non-`nil', then the suffixes
  565.      `.elc' and `.el' are not tried.  In this case, you must specify
  566.      the precise file name you want.
  567.  
  568.      If FILENAME is a relative file name, such as `foo' or
  569.      `baz/foo.bar', `load' searches for the file using the variable
  570.      `load-path'.  It appends FILENAME to each of the directories
  571.      listed in `load-path', and loads the first file it finds whose name
  572.      matches.  The current default directory is tried only if it is
  573.      specified in `load-path', where `nil' stands for the default
  574.      directory.  `load' tries all three possible suffixes in the first
  575.      directory in `load-path', then all three suffixes in the second
  576.      directory, and so on.
  577.  
  578.      If you get a warning that `foo.elc' is older than `foo.el', it
  579.      means you should consider recompiling `foo.el'.  *Note Byte
  580.      Compilation::.
  581.  
  582.      Messages like `Loading foo...' and `Loading foo...done' appear in
  583.      the echo area during loading unless NOMESSAGE is non-`nil'.
  584.  
  585.      Any unhandled errors while loading a file terminate loading.  If
  586.      the load was done for the sake of `autoload', any function
  587.      definitions made during the loading are undone.
  588.  
  589.      If `load' can't find the file to load, then normally it signals the
  590.      error `file-error' (with `Cannot open load file FILENAME').  But
  591.      if MISSING-OK is non-`nil', then `load' just returns `nil'.
  592.  
  593.      You can use the variable `load-read-function' to specify a function
  594.      for `load' to use instead of `read' for reading expressions.  See
  595.      below.
  596.  
  597.      `load' returns `t' if the file loads successfully.
  598.  
  599.  - User Option: load-path
  600.      The value of this variable is a list of directories to search when
  601.      loading files with `load'.  Each element is a string (which must be
  602.      a directory name) or `nil' (which stands for the current working
  603.      directory).  The value of `load-path' is initialized from the
  604.      environment variable `EMACSLOADPATH', if that exists; otherwise its
  605.      default value is specified in `emacs/src/paths.h' when XEmacs is
  606.      built.
  607.  
  608.      The syntax of `EMACSLOADPATH' is the same as used for `PATH'; `:'
  609.      (or `;', according to the operating system) separates directory
  610.      names, and `.' is used for the current default directory.  Here is
  611.      an example of how to set your `EMACSLOADPATH' variable from a
  612.      `csh' `.login' file:
  613.  
  614.           setenv EMACSLOADPATH .:/user/bil/emacs:/usr/lib/emacs/lisp
  615.  
  616.      Here is how to set it using `sh':
  617.  
  618.           export EMACSLOADPATH
  619.           EMACSLOADPATH=.:/user/bil/emacs:/usr/local/lib/emacs/lisp
  620.  
  621.      Here is an example of code you can place in a `.emacs' file to add
  622.      several directories to the front of your default `load-path':
  623.  
  624.           (setq load-path
  625.                 (append (list nil "/user/bil/emacs"
  626.                               "/usr/local/lisplib"
  627.                               "~/emacs")
  628.                         load-path))
  629.  
  630.      In this example, the path searches the current working directory
  631.      first, followed then by the `/user/bil/emacs' directory, the
  632.      `/usr/local/lisplib' directory, and the `~/emacs' directory, which
  633.      are then followed by the standard directories for Lisp code.
  634.  
  635.      The command line options `-l' or `-load' specify a Lisp library to
  636.      load as part of Emacs startup.  Since this file might be in the
  637.      current directory, Emacs 18 temporarily adds the current directory
  638.      to the front of `load-path' so the file can be found there.  Newer
  639.      Emacs versions also find such files in the current directory, but
  640.      without altering `load-path'.
  641.  
  642.      Dumping Emacs uses a special value of `load-path'.  If the value of
  643.      `load-path' at the end of dumping is unchanged (that is, still the
  644.      same special value), the dumped Emacs switches to the ordinary
  645.      `load-path' value when it starts up, as described above.  But if
  646.      `load-path' has any other value at the end of dumping, that value
  647.      is used for execution of the dumped Emacs also.
  648.  
  649.      Therefore, if you want to change `load-path' temporarily for
  650.      loading a few libraries in `site-init.el' or `site-load.el', you
  651.      should bind `load-path' locally with `let' around the calls to
  652.      `load'.
  653.  
  654.  - Variable: load-in-progress
  655.      This variable is non-`nil' if Emacs is in the process of loading a
  656.      file, and it is `nil' otherwise.
  657.  
  658.  - Variable: load-read-function
  659.      This variable specifies an alternate expression-reading function
  660.      for `load' and `eval-region' to use instead of `read'.  The
  661.      function should accept one argument, just as `read' does.
  662.  
  663.      Normally, the variable's value is `nil', which means those
  664.      functions should use `read'.
  665.  
  666.    To learn how `load' is used to build XEmacs, see *Note Building
  667. XEmacs::.
  668.  
  669. 
  670. File: lispref.info,  Node: Autoload,  Next: Repeated Loading,  Prev: How Programs Do Loading,  Up: Loading
  671.  
  672. Autoload
  673. ========
  674.  
  675.    The "autoload" facility allows you to make a function or macro known
  676. in Lisp, but put off loading the file that defines it.  The first call
  677. to the function automatically reads the proper file to install the real
  678. definition and other associated code, then runs the real definition as
  679. if it had been loaded all along.
  680.  
  681.    There are two ways to set up an autoloaded function: by calling
  682. `autoload', and by writing a special "magic" comment in the source
  683. before the real definition.  `autoload' is the low-level primitive for
  684. autoloading; any Lisp program can call `autoload' at any time.  Magic
  685. comments do nothing on their own; they serve as a guide for the command
  686. `update-file-autoloads', which constructs calls to `autoload' and
  687. arranges to execute them when Emacs is built.  Magic comments are the
  688. most convenient way to make a function autoload, but only for packages
  689. installed along with Emacs.
  690.  
  691.  - Function: autoload FUNCTION FILENAME &optional DOCSTRING INTERACTIVE
  692.           TYPE
  693.      This function defines the function (or macro) named FUNCTION so as
  694.      to load automatically from FILENAME.  The string FILENAME
  695.      specifies the file to load to get the real definition of FUNCTION.
  696.  
  697.      The argument DOCSTRING is the documentation string for the
  698.      function.  Normally, this is the identical to the documentation
  699.      string in the function definition itself.  Specifying the
  700.      documentation string in the call to `autoload' makes it possible
  701.      to look at the documentation without loading the function's real
  702.      definition.
  703.  
  704.      If INTERACTIVE is non-`nil', then the function can be called
  705.      interactively.  This lets completion in `M-x' work without loading
  706.      the function's real definition.  The complete interactive
  707.      specification need not be given here; it's not needed unless the
  708.      user actually calls FUNCTION, and when that happens, it's time to
  709.      load the real definition.
  710.  
  711.      You can autoload macros and keymaps as well as ordinary functions.
  712.      Specify TYPE as `macro' if FUNCTION is really a macro.  Specify
  713.      TYPE as `keymap' if FUNCTION is really a keymap.  Various parts of
  714.      Emacs need to know this information without loading the real
  715.      definition.
  716.  
  717.      An autoloaded keymap loads automatically during key lookup when a
  718.      prefix key's binding is the symbol FUNCTION.  Autoloading does not
  719.      occur for other kinds of access to the keymap.  In particular, it
  720.      does not happen when a Lisp program gets the keymap from the value
  721.      of a variable and calls `define-key'; not even if the variable
  722.      name is the same symbol FUNCTION.
  723.  
  724.      If FUNCTION already has a non-void function definition that is not
  725.      an autoload object, `autoload' does nothing and returns `nil'.  If
  726.      the function cell of FUNCTION is void, or is already an autoload
  727.      object, then it is defined as an autoload object like this:
  728.  
  729.           (autoload FILENAME DOCSTRING INTERACTIVE TYPE)
  730.  
  731.      For example,
  732.  
  733.           (symbol-function 'run-prolog)
  734.                => (autoload "prolog" 169681 t nil)
  735.  
  736.      In this case, `"prolog"' is the name of the file to load, 169681
  737.      refers to the documentation string in the `emacs/etc/DOC' file
  738.      (*note Documentation Basics::.), `t' means the function is
  739.      interactive, and `nil' that it is not a macro or a keymap.
  740.  
  741.    The autoloaded file usually contains other definitions and may
  742. require or provide one or more features.  If the file is not completely
  743. loaded (due to an error in the evaluation of its contents), any function
  744. definitions or `provide' calls that occurred during the load are
  745. undone.  This is to ensure that the next attempt to call any function
  746. autoloading from this file will try again to load the file.  If not for
  747. this, then some of the functions in the file might appear defined, but
  748. they might fail to work properly for the lack of certain subroutines
  749. defined later in the file and not loaded successfully.
  750.  
  751.    XEmacs as distributed comes with many autoloaded functions.  The
  752. calls to `autoload' are in the file `loaddefs.el'.  There is a
  753. convenient way of updating them automatically.
  754.  
  755.    If the autoloaded file fails to define the desired Lisp function or
  756. macro, then an error is signaled with data `"Autoloading failed to
  757. define function FUNCTION-NAME"'.
  758.  
  759.    A magic autoload comment looks like `;;;###autoload', on a line by
  760. itself, just before the real definition of the function in its
  761. autoloadable source file.  The command `M-x update-file-autoloads'
  762. writes a corresponding `autoload' call into `loaddefs.el'.  Building
  763. Emacs loads `loaddefs.el' and thus calls `autoload'.  `M-x
  764. update-directory-autoloads' is even more powerful; it updates autoloads
  765. for all files in the current directory.
  766.  
  767.    The same magic comment can copy any kind of form into `loaddefs.el'.
  768. If the form following the magic comment is not a function definition,
  769. it is copied verbatim.  You can also use a magic comment to execute a
  770. form at build time *without* executing it when the file itself is
  771. loaded.  To do this, write the form "on the same line" as the magic
  772. comment.  Since it is in a comment, it does nothing when you load the
  773. source file; but `update-file-autoloads' copies it to `loaddefs.el',
  774. where it is executed while building Emacs.
  775.  
  776.    The following example shows how `doctor' is prepared for autoloading
  777. with a magic comment:
  778.  
  779.      ;;;###autoload
  780.      (defun doctor ()
  781.        "Switch to *doctor* buffer and start giving psychotherapy."
  782.        (interactive)
  783.        (switch-to-buffer "*doctor*")
  784.        (doctor-mode))
  785.  
  786. Here's what that produces in `loaddefs.el':
  787.  
  788.      (autoload 'doctor "doctor"
  789.        "\
  790.      Switch to *doctor* buffer and start giving psychotherapy."
  791.        t)
  792.  
  793. The backslash and newline immediately following the double-quote are a
  794. convention used only in the preloaded Lisp files such as `loaddefs.el';
  795. they tell `make-docfile' to put the documentation string in the
  796. `etc/DOC' file.  *Note Building XEmacs::.
  797.  
  798. 
  799. File: lispref.info,  Node: Repeated Loading,  Next: Named Features,  Prev: Autoload,  Up: Loading
  800.  
  801. Repeated Loading
  802. ================
  803.  
  804.    You may load one file more than once in an Emacs session.  For
  805. example, after you have rewritten and reinstalled a function definition
  806. by editing it in a buffer, you may wish to return to the original
  807. version; you can do this by reloading the file it came from.
  808.  
  809.    When you load or reload files, bear in mind that the `load' and
  810. `load-library' functions automatically load a byte-compiled file rather
  811. than a non-compiled file of similar name.  If you rewrite a file that
  812. you intend to save and reinstall, remember to byte-compile it if
  813. necessary; otherwise you may find yourself inadvertently reloading the
  814. older, byte-compiled file instead of your newer, non-compiled file!
  815.  
  816.    When writing the forms in a Lisp library file, keep in mind that the
  817. file might be loaded more than once.  For example, the choice of
  818. `defvar' vs. `defconst' for defining a variable depends on whether it
  819. is desirable to reinitialize the variable if the library is reloaded:
  820. `defconst' does so, and `defvar' does not.  (*Note Defining
  821. Variables::.)
  822.  
  823.    The simplest way to add an element to an alist is like this:
  824.  
  825.      (setq minor-mode-alist
  826.            (cons '(leif-mode " Leif") minor-mode-alist))
  827.  
  828. But this would add multiple elements if the library is reloaded.  To
  829. avoid the problem, write this:
  830.  
  831.      (or (assq 'leif-mode minor-mode-alist)
  832.          (setq minor-mode-alist
  833.                (cons '(leif-mode " Leif") minor-mode-alist)))
  834.  
  835.    To add an element to a list just once, use `add-to-list' (*note
  836. Setting Variables::.).
  837.  
  838.    Occasionally you will want to test explicitly whether a library has
  839. already been loaded.  Here's one way to test, in a library, whether it
  840. has been loaded before:
  841.  
  842.      (defvar foo-was-loaded)
  843.      
  844.      (if (not (boundp 'foo-was-loaded))
  845.          EXECUTE-FIRST-TIME-ONLY)
  846.      
  847.      (setq foo-was-loaded t)
  848.  
  849. If the library uses `provide' to provide a named feature, you can use
  850. `featurep' to test whether the library has been loaded.
  851.  
  852.    *Note Named Features::.
  853.  
  854. 
  855. File: lispref.info,  Node: Named Features,  Next: Unloading,  Prev: Repeated Loading,  Up: Loading
  856.  
  857. Features
  858. ========
  859.  
  860.    `provide' and `require' are an alternative to `autoload' for loading
  861. files automatically.  They work in terms of named "features".
  862. Autoloading is triggered by calling a specific function, but a feature
  863. is loaded the first time another program asks for it by name.
  864.  
  865.    A feature name is a symbol that stands for a collection of functions,
  866. variables, etc.  The file that defines them should "provide" the
  867. feature.  Another program that uses them may ensure they are defined by
  868. "requiring" the feature.  This loads the file of definitions if it
  869. hasn't been loaded already.
  870.  
  871.    To require the presence of a feature, call `require' with the
  872. feature name as argument.  `require' looks in the global variable
  873. `features' to see whether the desired feature has been provided
  874. already.  If not, it loads the feature from the appropriate file.  This
  875. file should call `provide' at the top level to add the feature to
  876. `features'; if it fails to do so, `require' signals an error.
  877.  
  878.    Features are normally named after the files that provide them, so
  879. that `require' need not be given the file name.
  880.  
  881.    For example, in `emacs/lisp/prolog.el', the definition for
  882. `run-prolog' includes the following code:
  883.  
  884.      (defun run-prolog ()
  885.        "Run an inferior Prolog process, input and output via buffer *prolog*."
  886.        (interactive)
  887.        (require 'comint)
  888.        (switch-to-buffer (make-comint "prolog" prolog-program-name))
  889.        (inferior-prolog-mode))
  890.  
  891. The expression `(require 'comint)' loads the file `comint.el' if it has
  892. not yet been loaded.  This ensures that `make-comint' is defined.
  893.  
  894.    The `comint.el' file contains the following top-level expression:
  895.  
  896.      (provide 'comint)
  897.  
  898. This adds `comint' to the global `features' list, so that `(require
  899. 'comint)' will henceforth know that nothing needs to be done.
  900.  
  901.    When `require' is used at top level in a file, it takes effect when
  902. you byte-compile that file (*note Byte Compilation::.) as well as when
  903. you load it.  This is in case the required package contains macros that
  904. the byte compiler must know about.
  905.  
  906.    Although top-level calls to `require' are evaluated during byte
  907. compilation, `provide' calls are not.  Therefore, you can ensure that a
  908. file of definitions is loaded before it is byte-compiled by including a
  909. `provide' followed by a `require' for the same feature, as in the
  910. following example.
  911.  
  912.      (provide 'my-feature)  ; Ignored by byte compiler,
  913.                             ;   evaluated by `load'.
  914.      (require 'my-feature)  ; Evaluated by byte compiler.
  915.  
  916. The compiler ignores the `provide', then processes the `require' by
  917. loading the file in question.  Loading the file does execute the
  918. `provide' call, so the subsequent `require' call does nothing while
  919. loading.
  920.  
  921.  - Function: provide FEATURE
  922.      This function announces that FEATURE is now loaded, or being
  923.      loaded, into the current XEmacs session.  This means that the
  924.      facilities associated with FEATURE are or will be available for
  925.      other Lisp programs.
  926.  
  927.      The direct effect of calling `provide' is to add FEATURE to the
  928.      front of the list `features' if it is not already in the list.
  929.      The argument FEATURE must be a symbol.  `provide' returns FEATURE.
  930.  
  931.           features
  932.                => (bar bish)
  933.           
  934.           (provide 'foo)
  935.                => foo
  936.           features
  937.                => (foo bar bish)
  938.  
  939.      When a file is loaded to satisfy an autoload, and it stops due to
  940.      an error in the evaluating its contents, any function definitions
  941.      or `provide' calls that occurred during the load are undone.
  942.      *Note Autoload::.
  943.  
  944.  - Function: require FEATURE &optional FILENAME
  945.      This function checks whether FEATURE is present in the current
  946.      XEmacs session (using `(featurep FEATURE)'; see below).  If it is
  947.      not, then `require' loads FILENAME with `load'.  If FILENAME is
  948.      not supplied, then the name of the symbol FEATURE is used as the
  949.      file name to load.
  950.  
  951.      If loading the file fails to provide FEATURE, `require' signals an
  952.      error, `Required feature FEATURE was not provided'.
  953.  
  954.  - Function: featurep FEATURE
  955.      This function returns `t' if FEATURE has been provided in the
  956.      current XEmacs session (i.e., FEATURE is a member of `features'.)
  957.  
  958.  - Variable: features
  959.      The value of this variable is a list of symbols that are the
  960.      features loaded in the current XEmacs session.  Each symbol was
  961.      put in this list with a call to `provide'.  The order of the
  962.      elements in the `features' list is not significant.
  963.  
  964. 
  965. File: lispref.info,  Node: Unloading,  Next: Hooks for Loading,  Prev: Named Features,  Up: Loading
  966.  
  967. Unloading
  968. =========
  969.  
  970.    You can discard the functions and variables loaded by a library to
  971. reclaim memory for other Lisp objects.  To do this, use the function
  972. `unload-feature':
  973.  
  974.  - Command: unload-feature FEATURE &optional FORCE
  975.      This command unloads the library that provided feature FEATURE.
  976.      It undefines all functions, macros, and variables defined in that
  977.      library with `defconst', `defvar', `defun', `defmacro', `defsubst'
  978.      and `defalias'.  It then restores any autoloads formerly
  979.      associated with those symbols.  (Loading saves these in the
  980.      `autoload' property of the symbol.)
  981.  
  982.      Ordinarily, `unload-feature' refuses to unload a library on which
  983.      other loaded libraries depend.  (A library A depends on library B
  984.      if A contains a `require' for B.)  If the optional argument FORCE
  985.      is non-`nil', dependencies are ignored and you can unload any
  986.      library.
  987.  
  988.    The `unload-feature' function is written in Lisp; its actions are
  989. based on the variable `load-history'.
  990.  
  991.  - Variable: load-history
  992.      This variable's value is an alist connecting library names with the
  993.      names of functions and variables they define, the features they
  994.      provide, and the features they require.
  995.  
  996.      Each element is a list and describes one library.  The CAR of the
  997.      list is the name of the library, as a string.  The rest of the
  998.      list is composed of these kinds of objects:
  999.  
  1000.         * Symbols that were defined by this library.
  1001.  
  1002.         * Lists of the form `(require . FEATURE)' indicating features
  1003.           that were required.
  1004.  
  1005.         * Lists of the form `(provide . FEATURE)' indicating features
  1006.           that were provided.
  1007.  
  1008.      The value of `load-history' may have one element whose CAR is
  1009.      `nil'.  This element describes definitions made with `eval-buffer'
  1010.      on a buffer that is not visiting a file.
  1011.  
  1012.    The command `eval-region' updates `load-history', but does so by
  1013. adding the symbols defined to the element for the file being visited,
  1014. rather than replacing that element.
  1015.  
  1016. 
  1017. File: lispref.info,  Node: Hooks for Loading,  Prev: Unloading,  Up: Loading
  1018.  
  1019. Hooks for Loading
  1020. =================
  1021.  
  1022.    You can ask for code to be executed if and when a particular library
  1023. is loaded, by calling `eval-after-load'.
  1024.  
  1025.  - Function: eval-after-load LIBRARY FORM
  1026.      This function arranges to evaluate FORM at the end of loading the
  1027.      library LIBRARY, if and when LIBRARY is loaded.  If LIBRARY is
  1028.      already loaded, it evaluates FORM right away.
  1029.  
  1030.      The library name LIBRARY must exactly match the argument of
  1031.      `load'.  To get the proper results when an installed library is
  1032.      found by searching `load-path', you should not include any
  1033.      directory names in LIBRARY.
  1034.  
  1035.      An error in FORM does not undo the load, but does prevent
  1036.      execution of the rest of FORM.
  1037.  
  1038.    In general, well-designed Lisp programs should not use this feature.
  1039. The clean and modular ways to interact with a Lisp library are (1)
  1040. examine and set the library's variables (those which are meant for
  1041. outside use), and (2) call the library's functions.  If you wish to do
  1042. (1), you can do it immediately--there is no need to wait for when the
  1043. library is loaded.  To do (2), you must load the library (preferably
  1044. with `require').
  1045.  
  1046.    But it is ok to use `eval-after-load' in your personal customizations
  1047. if you don't feel they must meet the design standards of programs to be
  1048. released.
  1049.  
  1050.  - Variable: after-load-alist
  1051.      An alist of expressions to evaluate if and when particular
  1052.      libraries are loaded.  Each element looks like this:
  1053.  
  1054.           (FILENAME FORMS...)
  1055.  
  1056.      The function `load' checks `after-load-alist' in order to
  1057.      implement `eval-after-load'.
  1058.  
  1059. 
  1060. File: lispref.info,  Node: Byte Compilation,  Next: Debugging,  Prev: Loading,  Up: Top
  1061.  
  1062. Byte Compilation
  1063. ****************
  1064.  
  1065.    XEmacs Lisp has a "compiler" that translates functions written in
  1066. Lisp into a special representation called "byte-code" that can be
  1067. executed more efficiently.  The compiler replaces Lisp function
  1068. definitions with byte-code.  When a byte-code function is called, its
  1069. definition is evaluated by the "byte-code interpreter".
  1070.  
  1071.    Because the byte-compiled code is evaluated by the byte-code
  1072. interpreter, instead of being executed directly by the machine's
  1073. hardware (as true compiled code is), byte-code is completely
  1074. transportable from machine to machine without recompilation.  It is not,
  1075. however, as fast as true compiled code.
  1076.  
  1077.    In general, any version of Emacs can run byte-compiled code produced
  1078. by recent earlier versions of Emacs, but the reverse is not true.  In
  1079. particular, if you compile a program with Emacs 19.29, the compiled
  1080. code does not run in earlier versions.  Files compiled in versions
  1081. before 19.29 may not work in 19.29 if they contain character constants
  1082. with modifier bits, because the bits were renumbered in Emacs 19.29.
  1083.  
  1084.    *Note Compilation Errors::, for how to investigate errors occurring
  1085. in byte compilation.
  1086.  
  1087. * Menu:
  1088.  
  1089. * Speed of Byte-Code::          An example of speedup from byte compilation.
  1090. * Compilation Functions::       Byte compilation functions.
  1091. * Docs and Compilation::        Dynamic loading of documentation strings.
  1092. * Dynamic Loading::             Dynamic loading of individual functions.
  1093. * Eval During Compile::      Code to be evaluated when you compile.
  1094. * Byte-Code Objects::        The data type used for byte-compiled functions.
  1095. * Disassembly::                 Disassembling byte-code; how to read byte-code.
  1096.  
  1097. 
  1098. File: lispref.info,  Node: Speed of Byte-Code,  Next: Compilation Functions,  Up: Byte Compilation
  1099.  
  1100. Performance of Byte-Compiled Code
  1101. =================================
  1102.  
  1103.    A byte-compiled function is not as efficient as a primitive function
  1104. written in C, but runs much faster than the version written in Lisp.
  1105. Here is an example:
  1106.  
  1107.      (defun silly-loop (n)
  1108.        "Return time before and after N iterations of a loop."
  1109.        (let ((t1 (current-time-string)))
  1110.          (while (> (setq n (1- n))
  1111.                    0))
  1112.          (list t1 (current-time-string))))
  1113.      => silly-loop
  1114.      
  1115.      (silly-loop 100000)
  1116.      => ("Fri Mar 18 17:25:57 1994"
  1117.          "Fri Mar 18 17:26:28 1994")  ; 31 seconds
  1118.      
  1119.      (byte-compile 'silly-loop)
  1120.      => [Compiled code not shown]
  1121.      
  1122.      (silly-loop 100000)
  1123.      => ("Fri Mar 18 17:26:52 1994"
  1124.          "Fri Mar 18 17:26:58 1994")  ; 6 seconds
  1125.  
  1126.    In this example, the interpreted code required 31 seconds to run,
  1127. whereas the byte-compiled code required 6 seconds.  These results are
  1128. representative, but actual results will vary greatly.
  1129.  
  1130.